/*
 * @Author: zengwj
 * @Date: 2022-08-10 16:48:53
 * @LastEditors: zengwj
 * @LastEditTime: 2022-08-10 16:56:47
 * @Description: 解析模板字符串，生成ast 抽象语法树
 */

import generate from './generate.js'
import parse from './parse.js'

/**
 * @description:
 * @param {*} template 模板字符串
 * @return {*}  渲染函数
 */
export default function compileToFunction(template) {
	//解析template 生成ast 抽象语法树
	const ast = parse(template)
	//ast 生成render 渲染函数
	const render = generate(ast)
	return render
}
